﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace TSVNAddin.Core
{
	public class WorkingRootRecover
	{
		private readonly IDialogFactory _DialogFactory;

		public WorkingRootRecover(IDialogFactory dialogFactory)
		{
			_DialogFactory = dialogFactory;
		}

		public virtual string ChooseWorkingRoot(string currentWorkingRoot)
		{
			using (var dlg = _DialogFactory.CreateSetWorkingRootDialog())
			{
				dlg.SelectedWorkingRoot = currentWorkingRoot;

				if (dlg.ShowDialog() != DialogResult.OK)
					return currentWorkingRoot;

				return dlg.SelectedWorkingRoot;
			}
		}
	}
}
